Do not know the socket and TCP connection process, do not know the sockettcp connection
Directory:1. Background2. Detailed connection Process Analysis2.1 socket () function2.2 bind () function2.3 listen () and connect () Functions2.3.1 in-depth
The code under Windows is as follows
Server.cpp #include
Client.cpp #include
The following code for Linux is as follows:Makefile
CLI=CLI
ser=ser
dir=.
cc=g++
ser_obj=$ (dir)/ser.o
cli_obj=$ (dir)/cli.o ser_src=$
(dir)/ser.cpp
SetSockOpt Method
[CPP]View Plain copy print? #include
intSetSockOpt (
intSocket
intLevel
intOption_name,
Const
void*option_value,
size_tOption_len);
The first parameter socket is a socket descriptor.
The second parameter level is the levels of the
The layer-7 network consists of the physical layer, data link layer, network layer, transmission layer, Session Layer, presentation layer, and application layer.The physical layer, data link layer, and network layer are usually called media layers,
/proc/sys/net DirectoryAll TCP/IP parameters are located in the/proc/sys/net directory (note that modifications to the contents of the/proc/sys/net directory are temporary and any modifications are lost after the system restarts), such as the
Doc1:/proc/sys/net DirectoryAll TCP/IP parameters are located in the/proc/sys/net directory (note that modifications to the contents of the/proc/sys/net directory are temporary and any modifications are lost after the system restarts), such as the
1. getsockopt and setsockopt Functions
These two functions are only used for sockets:
# Include int getsockopt (int sockfd, int level, int optname, void * optval, socklen_t * optlen); int setsockopt (int sockfd, int level, int optname, const void
First Order
The author introduces the client-server paradigm, the interface of socket sockets and common functions, and then enumerates the demo of UDP and TCP respectively.
This chapter about the next, the demo is a c example, the previous
Analysis of TCP/IP protocol families in iOS & Socket, iostcpIntroduction
This article mainly reviews TCP/UDP, HTTP, and Socket in the TCP/IP protocol family.(-- This article is very dry and has been brewing for a long time! Can you watch it
PHP socket programming. In-depth introduction to phpsocket programming this article mainly introduces phpsocket programming in a simple way. This article describes socket-related knowledge in detail, PHPsocket programming instance line-based content,
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.